<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:th="http://www.thymeleaf.org">
<head>
	<div th:replace="commons/html-header"></div>
</head>
<body class="skin-1">

<div th:replace="commons/head"></div>



<div class="main-container" id="main-container">

	<script type="text/javascript">

        try{gds.settings.check('main-container' , 'fixed')}catch(e){}

	</script>

	<div class="main-container-inner">

		<a class="menu-toggler" id="menu-toggler" href="#">

			<span class="menu-text"></span>

		</a>



		<div th:replace="enrolls/menu"></div>

		<div class="main-content">

			<div class="breadcrumbs" id="breadcrumbs">

				<script type="text/javascript">

                    try{gds.settings.check('breadcrumbs' , 'fixed')}catch(e){}

				</script>



				<ul class="breadcrumb">
					<li>
						<i class="icon-home home-icon"></i>
						<a href="#">Home</a>
					</li>
					<li class="active">
						<a>接口注册</a>
					</li>
				</ul><!-- .breadcrumb -->

			</div>
			<div class="page-content">

				<div class="page-header">
					<form class="form-inline" role="form">
						<div class="form-group">
							<label class="sr-only" for="search_APP_NAME">应用</label>
							<select class="form-control" id="search_APP_NAME">
								<option value=""> 全部 </option>
								<option th:each="app:${appLists}" th:value="${app.c_APP_ID}" th:text="${app.c_APP_NAME}"></option>
							</select>
						</div>
						<div class="form-group">
							<label class="sr-only" for="c_INTERF_NAME">接口名称</label>
							<input type="text" class="form-control" id="c_INTERF_NAME" placeholder="请输入接口名称" />
						</div>
						<button type="button" id="btn-query" class="btn btn-sm btn-info"><i class="icon-search"></i>查询</button>

						<div class="pull-right">
							<button type="button" id="btn-add" class="btn btn-sm btn-info" style="margin-right: 5px;margin-left: 5px;"><i class="icon-search"></i>新增接口</button>
							<!--<button type="button" id="btn-import" class="btn btn-sm btn-primary" style="margin-right: 5px;margin-left: 5px;"><i class="icon-search"></i>导入接口</button>
                            <input type="file" style="display: none" name="file" id="file" />-->
						</div>
					</form>

				</div>

				<div class="row">
					<div class="col-xs-12">
						<div class="table-responsive">
							<table id="tbl" class="table table-striped table-bordered table-hover">
								<thead>
								<tr>
									<th class="center">序号</th>
									<th>接口名称</th>
									<th>所属应用</th>
									<th>HTTP方法</th>
									<th>请求路径</th>
									<th>状态</th>
									<th>创建时间</th>
									<th colspan="2"></th>
								</tr>
								</thead>
								<tbody>

								</tbody>
							</table>
						</div><!-- /.table-responsive -->
					</div><!-- /.col -->

				</div><!-- /.row -->

			</div><!-- /.page-content -->

		</div><!-- /.main-content -->

	</div><!-- /.main-container-inner -->

	<div th:replace="enrolls/interf-modals"></div>

	<div class="modal fade" id="off_modal" tabindex="-1" role="dialog" aria-labelledby="offline_label" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						&times;
					</button>
					<h4 class="modal-title" id="offline_label">
						下线申请
					</h4>
				</div>
				<div class="modal-body">
					<div  style="margin-left: 5vh;margin-right: 5vh;">
						<form name="off_form" method="post" class="form-horizontal">
							<input type="hidden" name="c_INTERF_ID" id="off_C_INTERF_ID" />
							<div class="form-group">
								<label class="col-sm-3 control-label" for="off_C_INTERF_NAME">接口名称</label>
								<div class="col-sm-9">
									<input class="form-control" name="c_INTERF_NAME" type="text" id="off_C_INTERF_NAME" readonly="readonly" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label" for="md_C_INTERF_OFFLINE">下线原因</label>
								<div class="col-sm-9">
									<textarea style="resize: none;" rows="6" class="form-control" type="text" name="c_INTERF_OFFLINE" id="md_C_INTERF_OFFLINE"
											  placeholder="请输入下线原因"/>
								</div>
							</div>
						</form>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消
					</button>
					<button type="button" id="btn-off-line" class="btn btn-sm btn-primary">
						提交
					</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal -->
	</div>

	<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
		<i class="icon-double-angle-up icon-only bigger-110"></i>
	</a>

</div><!-- /.main-container -->



<!-- basic scripts -->
<div th:replace="commons/html-js"></div>
<script th:src="@{/js/fuelux/fuelux.wizard.js}"></script>
<script th:src="@{/js/gds-elements.min.js}"></script>
<script th:src="@{/js/gds.min.js}"></script>

<!-- inline scripts related to this page -->

<script th:inline="javascript">
    var options = [[${dataTypes}]];
    var outHtml = '';
    //		<![CDATA[
    for (var i = 0; i< options.length; i++) {
        outHtml += '<option value="' + options[i].c_DICT_ITEM_VALUE +'">'+options[i].c_DICT_ITEM_NAME+'</option>'
    }
    // ]]>
</script>
<script>
    //        console.log(outHtml);

    var c_APP_ID,c_INTEF_NAME;
    var dataList;
    queryForList = function() {
        var reqdata ={};
        $.extend(reqdata , {c_APP_ID:c_APP_ID} ||{} , {c_INTERF_NAME:c_INTEF_NAME}||{} )
        $.post(contextPath + "/enroll/interf-list" , reqdata , function (data) {
            dataList = data;
            var html = '';
            //<![CDATA[
            if (null != data && data.length > 0) {
                dataList = data;
                var status ;
                for (var i = 0; i<data.length; i ++) {
                    status = data[i].c_INTERF_STATUS;
                    html += '<tr>';
                    html += ('' +
                    '<td class="center">' + (i+1) + '</td>' +
                    '<td><div title="' + data[i].c_INTERF_NAME + '">' + data[i].c_INTERF_NAME + '</div></td>' +
                    '<td><div title="' + data[i].c_APP_NAME + '">' + data[i].c_APP_NAME + '</div></td>' +
                    '<td><div title="' + data[i].c_INTERF_HTTP_METHOD + '">' + data[i].c_INTERF_HTTP_METHOD + '</div></td>' +
                    '<td><div title="' + data[i].c_INTERF_METHOD_NAME + '">' + (null == data[i].c_INTERF_METHOD_NAME?'':data[i].c_INTERF_METHOD_NAME) + '</div></td>' +
                    '<td><div title="' + data[i].c_INTERF_STATUS_NAME + '">' + data[i].c_INTERF_STATUS_NAME + '</div></td>' +
                    '<td><div title="' + data[i].c_CREATE_TIME + '">' + data[i].c_CREATE_TIME + '</div></td>');
                    html +='<td colspan="2">';
                    if ('INTERF_STATUS_INIT' == data[i].c_INTERF_STATUS) {
                        html += '<button class="btn btn-xs btn-primary" style="margin-right:5px;" onclick="editIntef(\'' + data[i].c_INTERF_ID + '\',\'update\')"><i class="icon-edit"></i>编辑</button>';
                        html += '<button class="btn btn-xs btn-info" style="margin-right:5px;" onclick="testIntef(\'' + data[i].c_INTERF_ID + '\')"><i class="icon-retweet"></i>测试</button>';
                        html += '<button class="btn btn-xs btn-danger" style="margin-right:5px;" onclick="delInterf(\'' + data[i].c_INTERF_ID + '\')"><i class="icon-trash"></i>删除</button>';
                    } else if ('INTERF_STATUS_UNAUDIT' == data[i].c_INTERF_STATUS) {
                        html += '已注册待审核';
                    } else if ('INTERF_STATUS_PUBLISH' == data[i].c_INTERF_STATUS) {
                        html += '<button class="btn btn-xs btn-warning" style="margin-right:5px;" onclick="editIntef(\'' + data[i].c_INTERF_ID + '\',\'change\')"><i class="icon-retweet"></i>变更</button>';
                        html += '<button class="btn btn-xs btn-danger" style="margin-right:5px;" onclick="offIntef(\'' + data[i].c_INTERF_ID + '\',\'' + data[i].c_INTERF_NAME +'\')"><i class="icon-off"></i>下线</button>';
                    } else  {
                        html += '<button class="btn btn-xs btn-danger" style="margin-right:5px;" onclick="delIntef(\'' + data[i].c_INTERF_ID + '\')"><i class="icon-trash"></i>删除</button>';
                    }
                    html +='</td>';
                    html += '</tr>';
                }

            }
            // ]]>
            $("#tbl tbody").html(html);
        })
    };

    //		<![CDATA[
    var tr =
        "<tr>" +
        "<td><input class='form-control' type='hidden' name='c_IPARAMS_ID' /><input class='form-control' type='text' name='c_IPARAMS_VALUE' /></td>" +
        "<td><input class='form-control' type='text' name='c_IPARAMS_NAME' /></td>" +
        "<td><select class='form-control' name='c_IPARAMS_DATATYPE'>{{0}}</select></td>" +
        "<td><input class='form-control' type='text' name='c_IPARAMS_SERV_ID' /></td>" +
        "<td><button class='btn btn-xs btn-default' onclick='removeIparams(this)'>删除</button></td>" +
        "</tr>";

    var soapRequest =
        "&lt;soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"{{1}}\"&gt;<br/>&lt;soap:Header/&gt;<br/>&lt;soap:Body&gt;<br/>&lt;web:{{0}}&gt;<br/>&lt;!-- <br/>请在这里填写接口的请求参数，格式为:<br/>&lt;web:userName&gt;1&lt;/web:userName&gt;<br/> --&gt;<br/>&lt;/web:{{0}}&gt;<br/>&lt;/soap:Body&gt;<br/>&lt;/soap:Envelope&gt;"
    //		]]>
    addIParams = function () {
        $("#out_param_table tbody").append(tr.replace(/\{\{0\}\}/gi,outHtml));
    };

    delInterf = function (c_INTERF_ID) {
        bootbox.confirm({
            buttons: {
                confirm : {
                    label : '确定',
                    className: 'btn btn-sm btn-primary'
                },
                cancel : {
                    label : '取消',
                    className: 'btn btn-sm btn-default'
                }
            },
            title:'确认',
            message : '确认删除该接口?',
            callback : function (result) {
                if (result) {
                    $.post(contextPath + "/enroll/interf/" + c_INTERF_ID +"/delete" , function (data) {
                        queryForList();
                    })
                }

            }
        });
    };

    offIntef = function(c_INTERF_ID,c_INTERF_NAME){
        $("#off_modal").modal();
        $("#off_C_INTERF_ID").val(c_INTERF_ID);
        $("#off_C_INTERF_NAME").val(c_INTERF_NAME);
	};

    saveInterf = function (saveType) {
        var reqdata = {};
        $.extend(reqdata,$("#base_form").serializeJson(),$("#server_form").serializeJson(),$("#prms_form").serializeJson());
        reqdata.c_INTERF_UNIFY = $("#prms_INTERF_UNIFY").prop("checked") ? '1' : '0';
        var iparamsArr = new Array();
        $("#out_param_table tbody tr").each(function (index, obj) {
            // <![CDATA[
            if ($(this).find("input[name=c_IPARAMS_VALUE]").val() != '' &&
                $(this).find("select[name=c_IPARAMS_DATATYPE]").val() != '' ) {
                iparamsArr.push({c_IPARAMS_ID:$(this).find("input[name=c_IPARAMS_ID]").val(),c_IPARAMS_NAME:$(this).find("input[name=c_IPARAMS_VALUE]").val(),C_IPARAMS_REMARK:$(this).find("input[name=c_IPARAMS_NAME]").val(),c_IPARAMS_DATATYPE:$(this).find("select[name=c_IPARAMS_DATATYPE]").val(),C_IPARAMS_SERVICE:$(this).find("input[name=c_IPARAMS_SERV_ID]").val()})
            }
            // ]]>
        });
//            $.extend(reqdata , {iparams:iparamsArr} | {});
        // <![CDATA[
        if (null != iparamsArr && iparamsArr.length > 0) {
            reqdata.iparams = iparamsArr;
        }
        // ]]>

        $.ajax({
            type: "post",
            url: contextPath + "/enroll/interf/" + saveType,
            data:JSON.stringify(reqdata),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                //<![CDATA[
                if (null != data) {
                    if (null != data) {
                        bootbox.alert({
                            buttons: {
                                ok : {
                                    lable : '确定',
                                    "className": "btn-sm btn-success"
                                }
                            },
                            message: data.msg,
                            callback: function () {
                                if (0 == data.code) {
                                    $("#modal-wizard").modal('hide');
                                    queryForList();
                                }
                            }
                        });
                    }
                }
                return false;
                // ]]>
            }, error: function () {
                bootbox.dialog({
                    message: '<span class="bigger-110">保存应用信息出错！</span>',
                    buttons:
                        {
                            "danger" :
                                {
                                    "label" : "确定",
                                    "className" : "btn-sm btn-danger"
                                }
                        }
                });
            }
        });
    };

    var c_END_POINT,c_HTTP_METHOD,c_OUT_PARAM_TYPE;
    testIntef = function (c_INTERF_ID) {
        $("#interfReq").html('');
        $("#interfRsp textarea").html('');
        $("#btn-reg").hide();

        c_END_POINT='',c_HTTP_METHOD='',c_OUT_PARAM_TYPE='';
        $(dataList).each(function (index, obj) {
            if (c_INTERF_ID == obj.c_INTERF_ID) {
                c_END_POINT = obj.c_INTERF_ENDPOINT;
                c_HTTP_METHOD = obj.c_INTERF_HTTP_METHOD,
                    c_OUT_PARAM_TYPE = obj.c_IPARAMS_OUT_TYPE
                $("#interfReq").html(soapRequest.replace(/\{\{0\}\}/gi,obj.c_INTERF_METHOD_NAME).replace(/\{\{1\}\}/gi,obj.c_INTERF_NAMEP));
                $("#testModal").modal();
                $("#btn-reg").on("click" , function () {
                    $.post(contextPath + "/enroll/interf/" + c_INTERF_ID + "/reg" , function (data) {
                        // <![CDATA[
                        if (null != data) {
                            bootbox.alert({
                                buttons: {
                                    ok : {
                                        lable : '确定',
                                        "className": "btn-sm btn-success"
                                    }
                                },
                                message: data.msg,
                                callback: function () {
                                    if (0 == data.code) {
                                        queryForList();
                                    }
                                }
                            })
                        }
                        // ]]>
                    })
                });
                return false;
            }
        })
    };

    $("#btn-off-line").on("click" , function () {
        $.post(contextPath + "/enroll/" + $("#off_C_INTERF_ID").val() + "/interfsOffLine" ,{c_VERIFY_REMARK:$("#md_C_INTERF_OFFLINE").val()}, function (data) {
            $("#off_modal").modal("hide");
            queryForList();
        })
    });



    validateForm = function () {
        //<![CDATA[
        $('#base_form,#server_form').bootstrapValidator({
            message: 'This value is not valid',
            excluded: ':disabled',
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                c_INTERF_NAME: {
                    validators: {
                        notEmpty: {
                            message: '接口名称不能为空'
                        },
                        stringLength: {
                            min: 1,
                            max: 64,
                            message: '接口名称不能超过64个字符'
                        }
                    }
                },
                c_APP_ID: {
                    validators: {
                        notEmpty: {
                            message: '所属应用不能为空'
                        }
                    }
                },
                c_INTERF_REMARK: {
                    message: 'The username is not valid',
                    validators: {
                        stringLength: {
                            max: 1024,
                            message: '接口描述不能超过1024个字符'
                        }
                    }
                },
                c_INTERF_ENDPOINT : {
                    validators: {
                        notEmpty: {
                            message: '服务地址不能为空'
                        },
                        stringLength: {
                            max: 512,
                            message: '服务地址不能超过512个字符'
                        }
                    }
                },
                c_INTERF_NAMEP : {
                    validators: {
                        notEmpty: {
                            message: '命名空间不能为空'
                        },
                        stringLength: {
                            max: 512,
                            message: '命名空间不能超过512个字符'
                        }
                    }
                },
                c_INTERF_METHOD_NAME : {
                    validators: {
                        notEmpty: {
                            message: '接口方法不能为空'
                        },
                        stringLength: {
                            max: 128,
                            message: '接口方法不能超过512个字符'
                        }
                    }
                }
            }
        }).on('error.form.bv', function (e) {
            console.log('error');

            // Active the panel element containing the first invalid element
            var $form = $(e.target),
                validator = $form.data('bootstrapValidator'),
                $invalidField = validator.getInvalidFields().eq(0),
                $collapse = $invalidField.parents('.collapse');

            $collapse.collapse('show');
        });
        //]]>

    };

    var currentStep = 1;
    form_wizard = function () {
        $('#modal-wizard .modal-header').gds_wizard().on('change' , function(e, info){
            //
            $("#wizard-next-save i").prop("class","icon-arrow-right icon-on-right");
//                $("#wizard-next-test").hide();

            // <![CDATA[
            currentStep = 1;
            if( (info.direction == "next")) {
                //currentStep ++ ;
                if ('modal-step1' == $(".step-pane.active").attr("id")) {
                    return $("#base_form").data('bootstrapValidator').validate().isValid();
                } else if('modal-step2' == $(".step-pane.active").attr("id") ) {
                    currentStep = 2;
                    if ($("#server_form").data('bootstrapValidator').validate().isValid()) {
                        $("#wizard-next-save i").prop("class","icon-ok icon-on-right");
                        return true;
                    }
                    return false;
                }  /*else if('modal-step3' == $(".step-pane.active").attr("id")) {
				 $("#wizard-next-save i").prop("class","icon-ok icon-on-right");
				 $("#soapRequest").text(soapRequest.replace(/\{\{0\}\}/gi,$("#serv_INTERF_METHOD_NAME").val()).replace(/\{\{1\}\}/gi,$("#serv_INTERF_NAMEP").val()));
				 $("#wizard-next-test").show();
				 //                    $("#wizard-next-reg").show();
				 //return $("#server_form").data('bootstrapValidator').validate().isValid();
				 }*/
            } else {
                currentStep = 1;
            }
            // ]]>

        }).on("changed" , function (e , info) {
            $("#wizard-next-save").removeAttr("onclick");
            if (2 == currentStep) {
                $("#wizard-next-save").attr("onclick" ,'es()');
            }

        });

    };
    var saveType;
    removeIparams = function (btn) {
        $(btn).parents("tr").remove();
        return false;
    };

    queryIparams = function (c_INTERF_ID) {
        $("#out_param_table tbody").html('');
        $.post(contextPath + "/enroll/interf/params",{c_INTERF_ID: c_INTERF_ID} , function (data) {
//			    <![CDATA[
            if (null != data && data.length > 0 ) {
                var html = "";
                var tr =
                    "<tr iparms='{{1}}'>" +
                    "<td><input class='form-control' type='hidden' name='c_IPARAMS_ID' /><input class='form-control' type='text' name='c_IPARAMS_VALUE' /></td>" +
                    "<td><input class='form-control' type='text' name='c_IPARAMS_NAME' /></td>" +
                    "<td><select class='form-control' name='c_IPARAMS_DATATYPE'>{{0}}</select></td>" +
                    "<td><input class='form-control' type='text' name='c_IPARAMS_SERV_ID' /></td>" +
                    "<td><button class='btn btn-xs btn-default' onclick='removeIparams(this)'>删除</button></td>" +
                    "</tr>";
                for (var i = 0; i< data.length; i++) {
                    var htmlTR = tr.replace(/\{\{0\}\}/gi,outHtml).replace(/\{\{1\}\}/gi,data[i].c_IPARAMS_ID);

                    $("#out_param_table tbody").append(htmlTR);
                    $("#out_param_table tbody tr:last").find("input[name=c_IPARAMS_ID]").val(data[i].c_IPARAMS_ID);
                    $("#out_param_table tbody tr:last").find("input[name=c_IPARAMS_VALUE]").prop("readonly","readonly").val(data[i].c_IPARAMS_NAME);
                    $("#out_param_table tbody tr:last").find("input[name=c_IPARAMS_NAME]").val(data[i].c_IPARAMS_REMARK);
                    $("#out_param_table tbody tr:last").find("input[name=c_IPARAMS_DATATYPE]").val(data[i].c_IPARAMS_DATATYPE);
                    $("#out_param_table tbody tr:last").find("input[name=c_IPARAMS_SERV_ID]").val(data[i].c_IPARAMS_SERVICE);
                }
            }
//                ]]>
        })
    };
    es = function () {
        var msg = "确认信息填写正确并保存?";
        if ("change" == saveType) {
            msg = "若之前存在变更记录，审核通过后将覆盖之前的变更！"
        }
        bootbox.confirm({
            buttons: {
                confirm : {
                    label : '确定',
                    className: 'btn btn-sm btn-primary'
                },
                cancel : {
                    label : '取消',
                    className: 'btn btn-sm btn-default'
                }
            },
            title:'确定',
            message : msg,
            callback : function (result) {
                if (result) {
                    saveInterf(saveType);
                }

            }
        });
    }

    editIntef = function (id, type) {

        queryIparams(id);
        saveType = type;
        var c_INTERF_ID,c_INTERF_NAME,c_APP_ID,c_INTERF_REMARK,c_INTERF_ENDPOINT,c_INTERF_NAMEP,c_INTERF_PROTOCOL,c_INTERF_HTTP_METHOD,c_INTERF_METHOD_NAME,c_IPARAMS_OUT_TYPE,c_INTERF_UNIFY,c_INTERF_SERVICE;
        // <![CDATA[
        if (null != dataList && dataList.length > 0){
            $(dataList).each(function(index, obj) {
                if (obj.c_INTERF_ID == id) {
                    $("#base_form,#server_form,#prms_form").find("input,textarea,select").each(function(idx, objc) {
                        if ("c_INTERF_UNIFY" == $(this).attr("name")) {
                            $(this).prop("checked",dataList[index][$(this).attr("name")] == 1 ? true : false);
                            if (dataList[index][$(this).attr("name")] == 1) {
                                $("#prms_INTERF_SERVICE").parents("div.form-group").show();
                            } else {
                                $("#prms_INTERF_SERVICE").parents("div.form-group").hide();
                            }
                        }
                        $(this).val(dataList[index][$(this).attr("name")]);
                    });
                    $("#modal-wizard").modal();
                    return false;

                }
            });
        }
        // ]]>
    };
    $(document).ready(function () {
        form_wizard();
        $('#modal-wizard .wizard-actions .btn[data-dismiss=modal]').removeAttr('disabled');
        queryForList();

        $("#btn-query").on("click" , function () {
            c_APP_ID = $("#c_APP_ID").val();
            c_INTEF_NAME = $("#c_INTERF_NAME").val();
            queryForList();
        });

        $("#btn-add").on("click" , function () {
            saveType="insert";
            $("#myModalLabel").html("新增接口");
            $("#out_param_table tbody").html('');
            $("#modal-wizard input").val('');
            $("#modal-wizard textarea").val('');
            $("#modal-wizard select option:eq(0)").selected();
            $("#modal-wizard input:checkbox").removeAttr("checked");
//               $('#modal-wizard .modal-header').gds_wizard("selectedItem",{currentStep:1});
            $("#modal-wizard .wizard-steps li:eq(0)").trigger("click");
            $("#modal-wizard").modal();
        });

        $("#btn-rtest").on("click" ,function () {

            var reqdata = {
                c_SOAP_MAIN : $("#interfReq").text(),
                c_END_POINT : c_END_POINT,
                c_HTTP_METHOD:c_HTTP_METHOD,
                c_OUT_PARAM_TYPE:c_OUT_PARAM_TYPE
            }
            $.post(contextPath + "/enroll/testInterf",reqdata, function (data) {
                //<![CDATA[
                if (null != data && 0 == data.code) {
                    $("#interfRsp textarea").text(data.rsp);
                    $("#btn-reg").show();
                    //$("#btn-rtest").hide();
                }
                // ]]>
            })

        });

        //Modal验证销毁重构
        $('#modal-wizard').on('hidden.bs.modal', function() {
            $('#base_form,#server_form').data('bootstrapValidator').destroy();
            $('#base_form,#server_form').data('bootstrapValidator', null);
            validateForm();
            $("#modal-wizard input").val('');
            $("#modal-wizard textarea").val('');
            $("#modal-wizard select option:eq(0)").selected();
            $("#modal-wizard input:checkbox").removeAttr("checked");
//               $('#modal-wizard .modal-header').gds_wizard("selectedItem",{currentStep:1});
            $("#modal-wizard .wizard-steps li:eq(0)").trigger("click");
            currentStep = 1;
        });

        validateForm();

        $("#prms_INTERF_UNIFY").on("click" ,function () {
            $("#prms_INTERF_SERVICE").parents("div.form-group").toggle();
        });

        $("#wizard-next-reg").on("click" , function () {

            bootbox.confirm({
                buttons: {
                    confirm : {
                        label : '确定',
                        className: 'btn btn-sm btn-primary'
                    },
                    cancel : {
                        label : '取消',
                        className: 'btn btn-sm btn-default'
                    }
                },
                title:'确认',
                message : '确认信息填写正确并注册接口?',
                callback : function (result) {
                    if (result) {
                        saveInterf("reg");
                    }
                }
            });
        })
    });
</script>
</body>

</html>